package com.example.forum.controller;

import com.example.forum.common.AppResult;
import com.example.forum.exception.ApplicationException;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
//@Tag(name = "测试类的相关接口")
//@Api(tags = "测试类的相关接口")
@RestController
@RequestMapping("/test")
public class TestController {

//    @Operation(description = "测试接口1")
//    @ApiOperation("测试接口1")
    @GetMapping("/exception")
    public AppResult testException() throws  Exception{
        throw new Exception("这是一个Exception");
    }

//    @Operation(description = "测试接口2")
//    @ApiOperation("测试接口2")
    @GetMapping("/appException")
    public  AppResult testApplicationException(){
        throw new ApplicationException("这是一个ApplicationException");
    }

//    @ApiOperation("测试接口3，传入的姓名是")
//    @RequestMapping("/helloByName")
//    public String helloByName(@ApiParam("姓名") String name){
//        return  "hello:"+ name;
//    }
}
